﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
namespace MyWeb.Data
{
	public class DetailShopDAL : SqlDataProvider
	{

		#region[DetailShop_GetbyAll]
		public DataTable DetailShop_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_DetailShop_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[DetailShop_GetbyId]
		public DataTable DetailShop_GetById(string Data)
		{
			using (var cmd = new SqlCommand("sp_DetailShop_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@Id", Data));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[DetailShop_GetbyTop]
		public DataTable DetailShop_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_DetailShop_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[DetailShop_GetbyId_Product]
		public DataTable DetailShop_GetById_Product(string Id_Product)
		{
			using (var cmd = new SqlCommand("sp_DetailShop_GetById_Product", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@Id_Product", Id_Product));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[DetailShop_GetbyId_Shop]
		public DataTable DetailShop_GetById_Shop(string Id_Shop)
		{
			using (var cmd = new SqlCommand("sp_DetailShop_GetById_Shop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@Id_Shop", Id_Shop));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[DetailShop_Insert]
		public void DetailShop_Insert(DetailShopInfo Data)
		{
			using (var cmd = new SqlCommand("sp_DetailShop_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@Id_Shop", Data.Id_Shop));
				cmd.Parameters.Add(new SqlParameter("@Id_Product", Data.Id_Product));
				cmd.Parameters.Add(new SqlParameter("@Prince_New", Data.Prince_New));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
		#region[DetailShop_Update]
		public void DetailShop_Update(DetailShopInfo Data)
		{
			using (var cmd = new SqlCommand("sp_DetailShop_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@Id", Data.Id));
				cmd.Parameters.Add(new SqlParameter("@Id_Shop", Data.Id_Shop));
				cmd.Parameters.Add(new SqlParameter("@Id_Product", Data.Id_Product));
				cmd.Parameters.Add(new SqlParameter("@Prince_New", Data.Prince_New));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
		#region[DetailShop_Delete]
		public void DetailShop_Delete(string Data)
		{
			using (var cmd = new SqlCommand("sp_DetailShop_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@Id", Data));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
	}
}